<%@page import="java.rmi.RemoteException"%>
<%@page import="java.sql.SQLException"%>
<%@page import="exception.NotLoggedInException"%>
<%@page import="com.sun.xml.internal.txw2.Document"%>
<%@page import="java.rmi.Naming"%>
<%@page import="server.ForumHandlerInt"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="serverConnection.jsp" %>
<%
	if (session.getAttribute("userName")==null)
		response.sendRedirect("loggin.jsp");
	
	try
	{
		//System.out.println("user name:"+(String)session.getAttribute("userName")+ ",password: "+(String)session.getAttribute("password")+", forumid:"+(Integer)session.getAttribute("forumId")+", topicid:"+Integer.parseInt(request.getParameter("postId"))+", postid:"+(Integer)session.getAttribute("postId")+", title:"+(String)request.getParameter("postTitle")+", content:"+(String)request.getParameter("postContent"));
		
		forum.editPost((String)session.getAttribute("userName"),(String)session.getAttribute("password"),(Integer)session.getAttribute("forumId"),(Integer)session.getAttribute("topicId"),Integer.parseInt(request.getParameter("postId")),(String)request.getParameter("postTitle"),(String)request.getParameter("postContent"));
		System.out.println("inside");
	}
	catch(NotLoggedInException t)
	{
		response.sendRedirect("loggin.jsp");
		response.flushBuffer();
		return;
	}
	catch(SQLException s){
		   
		   
		   response.sendError(response.SC_INTERNAL_SERVER_ERROR,
			"SQL server is down");
		
			response.flushBuffer();
			return;
		   
		   
	   }
	   catch(RemoteException u){
		   
		   response.sendError(response.SC_INTERNAL_SERVER_ERROR,
			"forum server is down");
		
			response.flushBuffer();
			return;
	   }
	



%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<title>Insert title here</title>
</head>
<body>

</body>
</html>